#include "../header/stack.h"
#include <malloc.h>
SqStackint * Initstackint()
{
    SqStackint * sq;
    sq=(SqStackint *)malloc(sizeof(SqStackint));
    sq->top=-1;
    return sq;
}
SqStackchar * Initstackchar()
{
    SqStackchar * sq;
    sq=(SqStackchar *)malloc(sizeof(SqStackchar));
    sq->top=-1;
    return sq;
}
int Push(SqStackint *sq,int x)
{
	if(sq->top==StackSize-1)
		return 0;
	else
	{
		sq->top++;
		sq->data[sq->top]=x;
		return 1;
	}
}
int Pushchar(SqStackchar *sq,character x)
{
	if(sq->top==StackSize-1)
		return 0;
	else
	{
		sq->top++;
		sq->data[sq->top]=x;
		sq->data[sq->top].symbol = x.symbol;
		strcpy(sq->data[sq->top].value,x.value); 
		return 1;
	}
}
int Popint(SqStackint * sq)
{
	int x;
	if(sq->top==-1)
		return 0;
	else
	{
		x=sq->data[sq->top];
		sq->top--;
		return x;
	}
}
character Popchar(SqStackchar * sq)
{
	character x;
	if(sq->top!=-1)
	{
		x=sq->data[sq->top];
		sq->top--;
		return x;
	}
}
int gettopint(SqStackint * sq)
{
	int x;
	if(sq->top==-1)
		return 0;
	else
	{
		x=sq->data[sq->top];
		return x;
	}
}
character gettopchar(SqStackchar * sq)
{
	character x;
	if(sq->top!=-1)
	{
		x=sq->data[sq->top];
		return x;
	}
}
